<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <link rel="stylesheet" href="<%=request.getContextPath() %>/css/index_work.css">
    <script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.8.3.js"></script>

</head>
<body>
<form>
    歌曲名：<input type="text" name="sname"><br>
    来源：<input type="text" name="scome"><br>
    发布时间：<input type="text" name="sdate"><br>
    歌手：<div id="d1"></div><br>
    <input type="button" value="返回" onclick="ret()">
</form>

<script type="text/javascript">
    var sid = ${param.sid}
    $.post("select.do",{"sid":sid},function (song) {
        $("[name=sname]").val(song.sname);
        $("[name=scome]").val(song.scome);
        $("[name=sdate]").val(song.sdate);

        var a = song.listg;
        var bb = a[0].gname;
        $.post("huixian.do",function (list) {
            for(var x in list){
                if(bb.indexOf(list[x].gname)>=0){
                    $("#d1").append("<input type='checkbox' checked/>"+list[x].gname);
                }else{
                    $("#d1").append("<input type='checkbox'/>"+list[x].gname);
                }
            }
        },"json")
    })
function ret() {
    location="list.do"
}
</script>
</body>
</html>
